﻿using System;
using System.Web.UI;
using Wei8808Cms.BLL;
using Wei8808Cms.Model;
using Wei8808Cms.WebSite.UI;

namespace Wei8808Cms.WebSite.admin.Case
{
    public partial class AddCaseInfoForm : BasicPage
    {
        private readonly CaseBLL _bll = new CaseBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                chkLoginLevel("addCase");
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            var model = new CaseInfo
                            {
                                CaseName = txtCaseName.Text.Trim(),
                                CaseRemark = txtCaseRemark.Text.Trim(),
                                CaseDummyImg = txtCaseDummyImg.Text.Trim(),
                                CaseImg = txtCaseImg.Text.Trim(),
                                IsRec = 0
                            };
            model.IsRec = cblItem.Items[0].Selected ? 1 : 0;
            model.CreateUser = "李波";
            model.CreateTime = DateTime.Now;
            if (_bll.Add(model))
            {
                JscriptPrint("保存成功！", "AddCaseInfoForm.aspx", "Success");
            }
            else
            {
                JscriptPrint("保存失败！", "", "Error");
            }
        }
    }
}